<html>
<head>
<title>300px Body</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../logic/validation/pagination.css" />
<style type="text/css">
<!--
.style1 {
	color: #CCCCCC;
	font-weight: bold;
}
-->
.error_strings{ font-family:Verdana; font-size:14px; color:#660000;}
</style>
<link href="../admin/logic/validation/border.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (300px Body.jpg) -->
<script language="JavaScript" src="../admin/logic/validation/validation.js" type="text/javascript"></script>
 <script language="JavaScript" src="validation/parent_att_search.js" type="text/javascript"></script>
 
 
 

<table width="800" height="173" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
	<tr>
		<td>
			<img src="images/st_att_search.gif" width="800" height="69" alt=""></td>
	</tr>
	<tr >
	<td height="64" background="images/2.gif" style="background-repeat:repeat-y"><form action="parent_att_stud.php" method="post" onSubmit="return validate()"><table width="689" border="0" cellspacing="0" cellpadding="0" align="center">
	
	<?php
	    include'../admin/logic/Classes/db.php';
	
	    $sub=new Dbconnect();
	
	    $cons=$sub->getConnection();
	 
	    $result1=mysql_query("select sub_gr from subject_code",$cons);
		
		$user=$_SESSION['user'];
	    
		 //getting emplyee or registration number using User name
	    $result3=mysql_query("select emp_reg from login where u_name='$user'",$cons);
		
		while($row3=mysql_fetch_array($result3)){
		 $emp_reg=$row3['emp_reg'];
         }
		 
		 //getting student name using Registration number
		 
		 $result2=mysql_query("select l_name,f_name from student where reg_no='$emp_reg'",$cons);
		 
		 while($row2=mysql_fetch_array($result2)){
		 $first=$row2['f_name'];
		 $last=$row2['l_name'];
         }
		 
		 $full_name=$first." ".$last;
		 
		 $time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));
		 
		 include'../admin/logic/Classes/attstudentHandler.php'; 
		 
		
		 
		
		if(isset($_POST['Submit'])){
		
		 $subgr=$_POST['sltSubgr'];
		 $mon=$_POST['sltMon'];
		 $startrow="0";
		 $limit="15";
		 
		 $att=new AttStudentHandler();
		  $att->setConnect($cons);
		  $att->setRegno($emp_reg);
		  $att->setSubgr($subgr);
		  $att->setMonth($mon);
		  $result=$att->getSearch($startrow,$limit);
		  $num=mysql_num_rows($result);
		 $x=0;
		 
		 
		 } 
		  
		  
		  
		  
		?>
       
		
		
		
		
	     
	
      <tr>
        <td width="117"><strong>Subject Code</strong> </td>
        <td width="142"><select name="sltSubgr" id="sltSubgr">
          <option value="Select">Select</option>
          <?php while($row1=mysql_fetch_array($result1)) {?>
          <option value="<?php echo $row1['sub_gr'];  ?>"><?php echo $row1['sub_gr'];  ?> </option>
          <?php } ?>
        </select></td>
        <td width="123">
        <select name="sltMon" id="sltMon">
          <option value="Select" selected="selected">Month</option>
          <option value="1">January</option>
          <option value="2">February</option>
          <option value="3">March</option>
          <option value="4">April</option>
          <option value="5">May</option>
          <option value="6">June</option>
          <option value="7">July</option>
          <option value="8">August</option>
          <option value="9">September</option>
          <option value="10">October</option>
          <option value="11">November</option>
          <option value="12">December</option>
        </select></td>
        <td width="56"><input type="submit" name="Submit" value="Go"></td>
        <td width="101"><strong>Student Name</strong> </td>
        <td width="150"><div align="left" class="error_strings"><?php echo $full_name;  ?></div></td>
      </tr>
    </table>
	</form>
    &nbsp;
	<?php // checking button is pressed 
	
	if(isset($mon)) {  ?>
	
	<?php  if(!($num==0)){    ?>
	
	  <table width="380" border="1" cellspacing="0" cellpadding="0" align="center" class="table1">
        <tr bgcolor="#013565">
          <td width="105" height="26"><div align="center" class="style1">Reg_No</div></td>
          <td width="94"><div align="center" class="style1">Subject</div></td>
          <td width="101"><div align="center" class="style1">Grade</div></td>
          <td width="80"><div align="center" class="style1">Date</div></td>
        </tr>
		
		
		<?php while($row4=mysql_fetch_array($result)){ ?>
		<?php if($x%2==0) { ?>
		
        <tr bgcolor="#DDDDDD">
          <td height="23"><div align="center"><?php echo $row4['reg_no']; ?></div></td>
          <td><div align="center"><?php echo $row4['subject']; ?></div></td>
          <td><div align="center"><?php echo $row4['grade']; ?></div></td>
          <td><div align="center"><?php echo $row4['date']; ?></div></td>
        </tr>
		
		<?php } else { ?>
		
		<tr>
          <td height="23"><div align="center"><?php echo $row4['reg_no']; ?></div></td>
          <td><div align="center"><?php echo $row4['subject']; ?></div></td>
          <td><div align="center"><?php echo $row4['grade']; ?></div></td>
          <td><div align="center"><?php echo $row4['date']; ?></div></td>
        </tr>
		
		<?php }//ending point of ELSE;
		       $x=$x+1;
		      }//ending point of loop ?> 
      
	  
	  </table>
	  	<?php } else { ?><div align="center"> <strong> There is no attendance record to display </strong></div>
	  <?php }} ?>  
	  </td>
	</tr>
	<tr>
		<td>
			<img src="images/3.gif" width="800" height="40" alt=""></td>
	</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>